﻿using System;
using AutoMapper;
using PmSoft.Caching;
using System.ComponentModel.DataAnnotations;
using PmSoft;

namespace ManagementApi.Models.Project;

/// <summary>
/// 项目月统计报表
///</summary>
public class ReportProjectMonthEditForm
{
    /// <summary>
    /// 主键 
    ///</summary>
     [Display(Name="主键")]
     [Required(ErrorMessage = "{0}不能为空")]
     public int Id { get; set; }
    /// <summary>
    /// 统计月份 
    ///</summary>
     [Display(Name="统计月份")]
     [Required(ErrorMessage = "{0}不能为空")]
     public DateTime Month { get; set; }
    /// <summary>
    /// 项目id 
    ///</summary>
     [Display(Name="项目id")]
     [Required(ErrorMessage = "{0}不能为空")]
     public int ProjectId { get; set; }
    /// <summary>
    /// 项目名称 
    ///</summary>
     [Display(Name="项目名称")]
     [Required(ErrorMessage = "{0}不能为空")]
     public string ProjectName { get; set; }
    /// <summary>
    /// 专户状态 
    ///</summary>
     [Display(Name="专户状态")]
     [Required(ErrorMessage = "{0}不能为空")]
     public byte SpecialAccountStatus { get; set; }
    /// <summary>
    /// 考勤状态 
    ///</summary>
     [Display(Name="考勤状态")]
     [Required(ErrorMessage = "{0}不能为空")]
     public byte CheckinStatus { get; set; }
    /// <summary>
    /// 代发状态 
    ///</summary>
     [Display(Name="代发状态")]
     [Required(ErrorMessage = "{0}不能为空")]
     public byte WageStatus { get; set; }
    /// <summary>
    /// 进账状态 
    ///</summary>
     [Display(Name="进账状态")]
     [Required(ErrorMessage = "{0}不能为空")]
     public byte IncomeStatus { get; set; }
    /// <summary>
    /// 项目在建天数 
    ///</summary>
     [Display(Name="项目在建天数")]
     [Required(ErrorMessage = "{0}不能为空")]
     public int DaysUnderConstruction { get; set; }
    /// <summary>
    /// 对口部门 
    ///</summary>
     [Display(Name="对口部门")]
     [Required(ErrorMessage = "{0}不能为空")]
     public byte CounterpartDepartment { get; set; }
    /// <summary>
    /// 应进账总额 
    ///</summary>
     [Display(Name="应进账总额")]
     [Required(ErrorMessage = "{0}不能为空")]
     public decimal TotalAmountDue { get; set; }
    /// <summary>
    /// 实际进账总额 
    ///</summary>
     [Display(Name="实际进账总额")]
     [Required(ErrorMessage = "{0}不能为空")]
     public decimal TotalActualReceipts { get; set; }
    /// <summary>
    /// 理论余额 
    ///</summary>
     [Display(Name="理论余额")]
     [Required(ErrorMessage = "{0}不能为空")]
     public decimal TheoreticalBalance { get; set; }
    /// <summary>
    /// 线上代发金额 
    ///</summary>
     [Display(Name="线上代发金额")]
     [Required(ErrorMessage = "{0}不能为空")]
     public decimal OnlineAmount { get; set; }
    /// <summary>
    /// 线下代发金额 
    ///</summary>
     [Display(Name="线下代发金额")]
     [Required(ErrorMessage = "{0}不能为空")]
     public decimal OfflineAmount { get; set; }

#region 扩展字段

//这里自行增加扩展字段，如 项目名称

#endregion
}

public static class ReportProjectMonthExtensions
{
  public static ReportProjectMonthEditForm AsForm(this Modules.ReportProjectMonth entity)
  {
      ReportProjectMonthEditForm form = new();
      var mapper = ServiceAccessor.GetService<IMapper>();
      mapper.Map(entity, form);
      #region 这里给扩展字段赋值
      #endregion
      return form;
  }
}
